<?php

namespace app\common\model;

/**
 * [Report  举报表]
 * @author [C。]
 * @return html
 */
class Report extends Base
{
    protected $name = 'report';
    /**
     * 搜索举报列表
     * @param array $param
     */
    public function getlist($map, $from = 0, $size = 5,$field) {
        $join1 = [
            ['app_member am', 'am.id = r.memid'],
        ];
        $join2 = [
            ['app_topic at', 'at.id = r.topic_id'],
        ];
        $order = ['r.id' => 'desc'];
        return $this->field($field)
            ->alias('r')
            ->join($join1)
            ->join($join2)
            ->where($map)
            ->limit($from, $size)
            ->order($order)
            ->select();
    }
    /**
     * 搜索举报列表
     * @param array $param
     */
    public function getCount($map) {
        $join1 = [
            ['app_member am', 'am.id = r.memid'],
        ];
        $join2 = [
            ['app_topic at', 'at.id = r.topic_id'],
        ];
        $order = ['r.id' => 'desc'];
        return $this->alias('r')
            ->join($join1)
            ->join($join2)
            ->where($map)
            ->count();
    }
}